--
module MyHanoi where

-- ++++++++++++++++++++++++ Hanoi 次数
_h 1 prod = prod
_h n prod = _h (n - 1) $! (2 * prod + 1)

h n = _h n 1

-- ++++++++++++++++++++++++ 移动 64个盘子所需次数
t :: Integer
t = h 64

-- 所需年份
y :: Integer
y = div (h 64) (365 * 24 * 60 * 60)

-- ++++++++++++++++++++++++ 移动 具体操作
move :: (Eq a, Num a) => (a, b, b, b) -> [(b, b)]
move (1, from, to, via) = [(from, to)]
move (n, from, to, via) =
  move (n - 1, from, via, to)
    ++ [(from, to)]
    ++ move (n - 1, via, to, from)

hanoi :: (Eq a, Num a, Num b) => a -> [(b, b)]
hanoi n = move (n, 1, 2, 3)